package exception;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class AllExceptionHandler {
//    @RequestMapping("404")
//    @ResponseStatus(value = HttpStatus.NOT_FOUND,reason = "找不到页面")
//    public String notFind(){
//        return "other/404";
//    }
//    @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
//    public String serverError(Model model){
//        model.addAttribute("msg","服务器出错了" );
//        return "other/tips";
//    }
    @ExceptionHandler(Throwable.class)
    public String testExceptionHandler(Model model){
        model.addAttribute("msg","出错了" );
        return "other/tips";
    }
}
